<div id="sidebar">
<div id="">
    <h2><?php __('Actions'); ?></h2>
        <div class="actions">
            <ul>
                <li><?php echo $this->Html->link(__('Local events', true), array('controller' => 'events', 'action' => 'index','local_events')); ?> </li>

                <li><?php echo $this->Html->link(__('My RSVPs', true), array('controller' => 'events', 'action' => 'index','rsvps')); ?> </li>

                <li><?php echo $this->Html->link(__('My invites', true), array('controller' => 'events', 'action' => 'index','invites')); ?> </li>

                <li><?php echo $this->Html->link(__('Edit my profile', true), array('action' => 'edit_profile', $user['id'])); ?></li>
            </ul>
        </div>
</div>
</div>


<div class="users form">
<?php 
    echo($javascript->link("preview_image.js"));
    echo $this->Form->create('User', array('action'=>'edit_profile','enctype' => 'multipart/form-data'));
?>
	<fieldset>
 		<legend><?php __('Edit profile'); ?></legend>
	<?php
		echo $this->Form->input('email_addr',array( 'label' => 'Email adress'));
		echo $this->Form->input('passwd',array( 'label' => 'Old password'));
                echo $this->Form->input('password',array( 'label' => 'New password'));
                echo $this->Form->input('psword',array( 'label' => 'Repeat new password'));

                echo $this->Form->input('image',array('type'=>'file','id'=>'picField','onchange'=>'preview(this)','label'=>'New profile image'));
                echo '<center>';

                if(file_exists('img/profile/user/'.$user['id'].'.jpg')){
                    echo $this->Html->image('profile/user/'.$user['id'].'.jpg', array('alt' => 'Preview','id'=>'previewField'));
                }else{
                    echo $this->Html->image('default_user.jpg', array('alt' => 'Preview','id'=>'previewField'));
                }
                
                echo '<br/><br/>';
                echo '</center>';

                echo $this->Form->input('first_name',array( 'label' => 'First name'));
		echo $this->Form->input('last_name',array( 'label' => 'Last name'));
                echo $this->Form->input('phone',array( 'label' => 'Phone number'));
                echo $this->Form->input('addr1',array('label'=>'Primary Adress'));
                echo $this->Form->input('addr2',array('label'=>'Secondary Adress'));
                echo $this->Form->input('city',array('label'=>'City'));
                echo $this->Form->input('state',array('label'=>'State'));
                echo $this->Form->input('postal',array('label'=>'Postal'));
	?>
	</fieldset>
<?php echo $this->Form->end(__('Submit', true));?>
</div>
